//
//  UIButtonTestViewController.m
//  ZBTechniqueLibrary
//
//  Created by apple on 2018/9/30.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "UIButtonTestViewController.h"
#import "ZBButton.h"

@interface UIButtonTestViewController ()

@end

@implementation UIButtonTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.title = @"自定义按钮";
    
    //1.普通按钮
    ZBButton *button1 = [ZBButton zb_buttonWithType:ZBButtonType_None];
    [self.view addSubview:button1];
    [button1 setTitle:@"测试" forState:UIControlStateNormal];
    [button1 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [button1 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button1.frame = CGRectMake(30, 100, 100, 30);
    button1.backgroundColor = [UIColor yellowColor];
    
    //2.间距按钮
    ZBButton *button2 = [ZBButton zb_buttonWithType:ZBButtonType_LeftImageRightText offset:5];
    [self.view addSubview:button2];
    [button2 setTitle:@"测试2" forState:UIControlStateNormal];
    [button2 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    [button2 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button2.frame = CGRectMake(CGRectGetMaxX(button1.frame) + 20, 100, 100, 30);
    button2.backgroundColor = [UIColor grayColor];
    
    
    //3.左文右图按钮
    ZBButton *button3 = [ZBButton zb_buttonWithType:ZBButtonType_LeftTextRightImage offset:5];
    [self.view addSubview:button3];
    [button3 setTitle:@"测试3" forState:UIControlStateNormal];
    [button3 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    [button3 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button3.frame = CGRectMake(30, CGRectGetMaxY(button1.frame)+30, 100, 30);
    button3.backgroundColor = [UIColor yellowColor];
    
    //4.顶部图片按钮
    ZBButton *button4 = [ZBButton zb_buttonWithType:ZBButtonType_TopImageBottomText offset:10];
    [self.view addSubview:button4];
    [button4 setTitle:@"测试4" forState:UIControlStateNormal];
    [button4 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    [button4 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button4.frame = CGRectMake(30, CGRectGetMaxY(button3.frame)+30, 100, 100);
    button4.backgroundColor = [UIColor yellowColor];
    
    //5.顶部文字按钮
    ZBButton *button5 = [ZBButton zb_buttonWithType:ZBButtonType_TopTextBottomImage offset:10];
    [self.view addSubview:button5];
    [button5 setTitle:@"测试4" forState:UIControlStateNormal];
    [button5 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    [button5 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button5.frame = CGRectMake(CGRectGetMaxX(button4.frame) + 20, CGRectGetMaxY(button3.frame)+30, 100, 100);
    button5.backgroundColor = [UIColor grayColor];
    
    //5.只有文字按钮
    ZBButton *button6 = [ZBButton zb_buttonWithType:ZBButtonType_None];
    [self.view addSubview:button6];
    [button6 setTitle:@"测试6" forState:UIControlStateNormal];
    [button6 setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
    button6.frame = CGRectMake(30, CGRectGetMaxY(button4.frame)+30, 100, 30);
    button6.backgroundColor = [UIColor yellowColor];
    
    //5.只有图片按钮
    ZBButton *button7 = [ZBButton zb_buttonWithType:ZBButtonType_None];
    [self.view addSubview:button7];
    [button7 setImage:[UIImage imageNamed:@"default_select"] forState:UIControlStateNormal];
    button7.frame = CGRectMake(CGRectGetMaxX(button6.frame) + 20, CGRectGetMaxY(button4.frame)+30, 100, 30);
    button7.backgroundColor = [UIColor grayColor];
   
}


@end
